<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ include file="/wesite/view/common/base.jsp" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>巨达药网</title>
    <%@ include file="/wesite/view/common/common.jsp" %>
    <link rel="stylesheet" type="text/css" href="${webctx}/css/aui-slide.css"/>
    <script type="text/javascript" src="${webctx}/script/aui-tab.js"></script>
    <script type="text/javascript" src="${webctx}/script/aui-slide.js"></script>
    <script type="text/javascript" src="${webctx}/script/aui-scroll.js"></script>

    <style type="text/css">

        .homepage .project-nav {
            font-size: 0;
        }

        .homepage .project-nav img {
            display: block;
            width: 100%;
            margin: 0;
            padding: 0;
        }

        .homepage .product-box .hd {
            margin-top: .533333rem;
            border-bottom: #f2f2f2 .08rem solid;
        }

        .homepage .product-box {
            margin: 0;
        }

        .homepage .layout-left-1-right-2 .project-nav .nav-left {
            float: left;
            width: 40%;
            height: 9.4133333rem;
            border-right: .08rem solid #f2f2f2;
        }

        .homepage .layout-left-1-right-2 .project-nav .nav-right {
            float: left;
            width: 60%;
        }

        .homepage .layout-left-1-right-2 .project-nav .nav-right a:first-child {
            border-bottom: .08rem solid #f2f2f2;
        }

        .homepage .layout-left-1-right-2 .project-nav .nav-right a {
            display: block;
            width: 100%;
            height: 4.666667rem;
            -webkit-box-sizing: content-box;
            -moz-box-sizing: content-box;
            box-sizing: content-box;
        }

        .homepage .layout-left-2-right-1 .project-nav .nav-right {
            float: left;
            width: 40%;
            height: 9.4133333rem;
            border-left: .08rem solid #f2f2f2;
        }

        .homepage .layout-left-2-right-1 .project-nav .nav-left {
            float: left;
            width: 60%;
            height: 9.4133333rem;
        }

        .homepage .layout-left-2-right-1 .project-nav .nav-left a:first-child {
            border-bottom: .08rem solid #f2f2f2;
        }

        .homepage .layout-left-2-right-1 .project-nav .nav-left a {
            display: block;
            width: 100%;
            height: 4.666667rem;
            -webkit-box-sizing: content-box;
            -moz-box-sizing: content-box;
            box-sizing: content-box;
        }

        .homepage .layout-top-2-bottom-2 .project-nav li {
            float: left;
            width: 50%;
            height: auto;
            border-bottom: .08rem solid #f2f2f2;
            border-right: .08rem solid #f2f2f2;
        }

        .homepage .layout-top-2-bottom-2 .project-nav li:nth-child(2n) {
            border-right: .08rem solid #fff;
        }

        .homepage .layout-top-4-bottom-4 .project-nav li {
            float: left;
            width: 25%;
            height: auto;
            border-bottom: .08rem solid #f2f2f2;
            border-right: .08rem solid #f2f2f2;
        }

        .homepage .layout-top-4-bottom-4 .project-nav li:nth-child(4n) {
            border-right: .08rem solid #fff;
        }

        .homepage .layout-left-1-right-4 .project-nav .nav-left {
            float: left;
            width: 40%;
            height: 9.4133333rem;
        }

        .homepage .layout-left-1-right-4 .project-nav .nav-right {
            float: left;
            border-left: .08rem solid #f2f2f2;
            width: 60%;
            height: 9.36rem;
        }

        .homepage .layout-left-1-right-4 .project-nav .nav-right .nav-right-top {
            border-bottom: .0266667rem solid #f2f2f2;
        }

        .homepage .layout-left-1-right-4 .project-nav .nav-right .nav-right-item {
            display: block;
            width: 100%;
            height: 4.666667rem;
        }

        .homepage .layout-left-1-right-4 .project-nav .nav-right .nav-right-item a {
            float: left;
            width: 50%;
            height: 4.666667rem;
        }

        .homepage .layout-left-1-right-4 .project-nav .nav-right .nav-right-item a img {
            height: 4.666667rem;
        }

        .homepage .layout-left-1-right-4 .project-nav .nav-right .nav-right-item a:first-child {
            border-right: .0266667rem solid #f2f2f2;
        }

        .floor-title-row-space {
            margin-top: .533333rem;
        }

        .floor-title {
            height: 2.133333rem;
            line-height: 2.133333rem;
            border-bottom: #f2f2f2 .1066667rem solid;
            background-color: #fff;
            overflow: hidden;
        }

        .floor-title h4 {
            position: relative;
            line-height: 2.026667rem;
        }

        .floor-title h4 span {
            float: left;
            margin: .5rem .5rem 0 .5rem;
            width: .15rem;
            height: 1rem;
            background-color: #0daeff;
        }

        .floor-title a {
            float: right;
            font-family: "Microsoft YaHei";
            color: #999;
            font-size: 0.586667rem;
            padding-right: .9rem;
            position: relative;
            margin-right: .5rem;
        }

        .floor-title a span {
            background: url(${webctx}/images/ico-arrow-r.png) no-repeat center;
            background-size: 0.6rem;
            width: 0.6rem;
            height: 0.6rem;
            position: absolute;
            right: 0;
            top: 50%;
            margin-top: -0.3rem;
            z-index: 9999;
        }


    </style>

</head>
<body>
<div class="homepage">
    <div class="tab-content">

        <div class="search">
            <a class="classification" href="javascript:location.href='/we/WeLoadClsNav'"></a>
            <input type="text" placeholder="请输入商品名称,规格，厂家" onclick="javascript:location.href='/we/product/search';">
            <a class="message" href="javascript:window.location.href='/we/user/loadMyMessage'"></a>

        </div>

        <!-- 渐变背景 -->
        <div class="gradient-bg"></div>

        <div class="tab-ct-item" style="display:block">
            <!-- banner切换 -->
            <div id="aui-slide">
                <div class="aui-slide-wrap">

                    <c:forEach var="info" items="${banners }">
                        <div class="aui-slide-node">
                            <a href="${info.url}"><img src="<%=getRandomFileserver()%>${info.phototitle}"/></a>
                        </div>
                    </c:forEach>

                </div>
                <div class="aui-slide-page-wrap"><!--分页容器--></div>
            </div>
            <!-- ICON菜单 -->
            <div class="homepage-nav">
                <ul>

                    <li class="active-in">
                        <a href="${ctx }/we/product/active">
                            <i class="ico"></i>
                            <span>活动专区</span>
                        </a>
                    </li>
                    <li class="hislist-in">
                        <a href="${ctx}/we/loginHistory">
                            <i class="ico"></i>
                            <span>历史采购</span>
                        </a>
                    </li>
                    <li class="code-in">
                        <a href="${ctx }/we/features/scanBuy">
                            <i class="ico"></i>
                            <span>扫码采购</span>
                        </a>
                    </li>
                    <li class="coupon-in">
                        <a href="/we/home/my-coupon">
                            <i class="ico"></i>
                            <span>优惠券</span>
                        </a>
                    </li>
                    <li class="integral-in">
                        <a href="/we/home/integral">
                            <i class="ico"></i>
                            <span>我的积分</span>
                        </a>
                    </li>
                </ul>
            </div>

            <!-- 楼层 -->
            <c:forEach items="${uiFloors}" var="uiFloor">

                <div class="floor product-box">
                        <%--<h3>${uiFloor.title}</h3>--%>

                    <c:forEach items="${uiFloor.panels}" var="uiFloorPanel">

                        <c:choose>
                            <c:when test="${uiFloorPanel.title_mode eq 'NO_TITLE_MORE'}">
                                <div class="floor-title-row-space">
                                </div>
                            </c:when>
                            <c:when test="${uiFloorPanel.title_mode eq 'LEFT_AND_MORE'}">
                                <div class="floor-title hd">
                                    <h4 class="fl"><span></span>${uiFloorPanel.title}</h4>
                                    <a class="fr" href="${uiFloorPanel.link}">更多<span class="arrow-r"></span></a>
                                </div>
                            </c:when>
                            <c:when test="${uiFloorPanel.title_mode eq 'CENTER_NO_MORE'}">
                                <div class="floor-title hd">
                                    <h4 style="text-align: center;">${uiFloorPanel.title}</h4>
                                </div>
                            </c:when>
                            <c:when test="${uiFloorPanel.title_mode eq 'LEFT_NO_MORE'}">
                                <div class="floor-title hd">
                                    <h4>${uiFloorPanel.title}</h4>
                                </div>
                            </c:when>
                        </c:choose>

                        <c:choose>
                            <c:when test="${uiFloorPanel.type eq 'PRODUCT'}">

                                <div class="content">
                                    <ul>
                                        <c:forEach items="${uiFloorPanel.products}" var="uiFloorPanelProduct">
                                            <li onclick="javascript:window.location='${ctx}/we/product/${uiFloorPanelProduct.product_info.id}';">
                                                <img src="<%=getRandomFileserver()%>${uiFloorPanelProduct.product_info.photo}"
                                                     onerror="this.src='/wesite/images/noimg.jpg'">
                                                <h3>${uiFloorPanelProduct.product_info.name}</h3>
                                                <span class="company">${uiFloorPanelProduct.product_info.b_chanjia}</span>
                                                <span class="specifications">${uiFloorPanelProduct.product_info.b_guige}</span>
                                                <span class="price">
                                                    <p><i class="a">
                                                            <c:choose>
                                                                <c:when test="${!islogin}">
                                                                    登录可见
                                                                </c:when>
                                                                <c:when test="${!isuserauth}">
                                                                    审核通过可见
                                                                </c:when>
                                                                <c:when test="${islogin&&isuserauth}">
                                                                    ¥ ${uiFloorPanelProduct.product_info.price}
                                                                </c:when>
                                                            </c:choose>
                                                        </i>
                                                    </p>
                                                </span>
                                            </li>
                                        </c:forEach>
                                    </ul>
                                    <div class="cl"></div>
                                </div>

                            </c:when>
                            <c:when test="${uiFloorPanel.type eq 'ITEM'}">
                                <c:choose>
                                    <c:when test="${uiFloorPanel.layout eq 'WE_LEFT_ONE_RIGHT_TWO'}">
                                        <div class="layout-left-1-right-2">
                                            <c:forEach items="${uiFloorPanel.items}" var="uiFloorPanelItem" step="3"
                                                       varStatus="itemStatus">
                                                <c:if test="${ itemStatus.index % 3 == 0 }">
                                                    <div class="project-nav">
                                                        <div class="nav-left">
                                                            <a href="${uiFloorPanel.items[itemStatus.index].link}"><img
                                                                    style="${uiFloorPanel.items[itemStatus.index].css}"
                                                                    src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index].image}"
                                                                    alt=""></a>
                                                        </div>
                                                        <div class="nav-right">
                                                            <a href="${uiFloorPanel.items[itemStatus.index+1].link}"><img
                                                                    style="${uiFloorPanel.items[itemStatus.index+1].css}"
                                                                    src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+1].image}"
                                                                    alt=""></a>
                                                            <a href="${uiFloorPanel.items[itemStatus.index+2].link}"><img
                                                                    style="${uiFloorPanel.items[itemStatus.index+2].css}"
                                                                    src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+2].image}"
                                                                    alt=""></a>
                                                        </div>
                                                        <div class="cl"></div>
                                                    </div>
                                                </c:if>
                                            </c:forEach>
                                        </div>
                                    </c:when>
                                    <c:when test="${uiFloorPanel.layout eq 'WE_LEFT_ONE_RIGHT_FOUR'}">
                                        <div class="layout-left-1-right-4">
                                            <c:forEach items="${uiFloorPanel.items}" var="uiFloorPanelItem" step="5"
                                                       varStatus="itemStatus">
                                                <c:if test="${ itemStatus.index % 5 == 0 }">
                                                    <div class="project-nav">
                                                        <div class="nav-left">
                                                            <a href="${uiFloorPanel.items[itemStatus.index].link}"><img
                                                                    style="${uiFloorPanel.items[itemStatus.index].css}"
                                                                    src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index].image}"></a>
                                                        </div>
                                                        <div class="nav-right">
                                                            <div class="nav-right-item nav-right-top">
                                                                <a href="${uiFloorPanel.items[itemStatus.index+1].link}"><img
                                                                        style="${uiFloorPanel.items[itemStatus.index+1].css}"
                                                                        src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+1].image}"></a>
                                                                <a href="${uiFloorPanel.items[itemStatus.index+2].link}"><img
                                                                        style="${uiFloorPanel.items[itemStatus.index+2].css}"
                                                                        src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+2].image}"></a>
                                                            </div>
                                                            <div class="nav-right-item nav-right-bot">
                                                                <a href="${uiFloorPanel.items[itemStatus.index+3].link}"><img
                                                                        style="${uiFloorPanel.items[itemStatus.index+3].css}"
                                                                        src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+3].image}"></a>
                                                                <a href="${uiFloorPanel.items[itemStatus.index+4].link}"><img
                                                                        style="${uiFloorPanel.items[itemStatus.index+4].css}"
                                                                        src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+4].image}"></a>
                                                            </div>
                                                        </div>
                                                        <div class="cl"></div>
                                                    </div>
                                                </c:if>
                                            </c:forEach>
                                        </div>
                                    </c:when>
                                    <c:when test="${uiFloorPanel.layout eq 'WE_LEFT_TWO_RIGHT_ONE'}">
                                        <div class="layout-left-2-right-1">
                                            <c:forEach items="${uiFloorPanel.items}" var="uiFloorPanelItem" step="3"
                                                       varStatus="itemStatus">
                                                <c:if test="${ itemStatus.index % 3 == 0 }">
                                                    <div class="project-nav">
                                                        <div class="nav-left">
                                                            <a href="${uiFloorPanel.items[itemStatus.index].link}"><img
                                                                    style="${uiFloorPanel.items[itemStatus.index].css}"
                                                                    src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index].image}"></a>
                                                            <a href="${uiFloorPanel.items[itemStatus.index+1].link}"><img
                                                                    style="${uiFloorPanel.items[itemStatus.index+1].css}"
                                                                    src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+1].image}"></a>
                                                        </div>
                                                        <div class="nav-right">
                                                            <a href="${uiFloorPanel.items[itemStatus.index+2].link}"><img
                                                                    style="${uiFloorPanel.items[itemStatus.index+2].css}"
                                                                    src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+2].image}"></a>
                                                        </div>
                                                        <div class="cl"></div>
                                                    </div>
                                                </c:if>
                                            </c:forEach>
                                        </div>
                                    </c:when>
                                    <c:when test="${uiFloorPanel.layout eq 'WE_TWO_COLUMN'}">
                                        <div class="layout-top-2-bottom-2">
                                            <div class="project-nav">
                                                <ul>
                                                    <c:forEach items="${uiFloorPanel.items}" var="uiFloorPanelItem"
                                                               step="2" varStatus="itemStatus">
                                                        <c:if test="${ itemStatus.index % 2 == 0 }">
                                                            <li>
                                                                <a href="${uiFloorPanel.items[itemStatus.index].link}"><img
                                                                        style="${uiFloorPanel.items[itemStatus.index].css}"
                                                                        src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index].image}"></a>/li>
                                                            <li>
                                                                <a href="${uiFloorPanel.items[itemStatus.index+1].link}"><img
                                                                        style="${uiFloorPanel.items[itemStatus.index+1].css}"
                                                                        src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+1].image}"></a>
                                                            </li>
                                                        </c:if>
                                                    </c:forEach>
                                                </ul>
                                                <div class="cl"></div>
                                            </div>
                                        </div>
                                    </c:when>
                                    <c:when test="${uiFloorPanel.layout eq 'WE_FOUR_COLUMN'}">
                                        <div class="layout-top-4-bottom-4">
                                            <div class="project-nav">
                                                <ul>
                                                    <c:forEach items="${uiFloorPanel.items}" var="uiFloorPanelItem"
                                                               step="4" varStatus="itemStatus">
                                                        <c:if test="${ itemStatus.index % 4 == 0 }">
                                                            <div>
                                                                <li>
                                                                    <a href="${uiFloorPanel.items[itemStatus.index].link}"><img
                                                                            style="${uiFloorPanel.items[itemStatus.index].css}"
                                                                            src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index].image}"></a>
                                                                </li>
                                                                <li>
                                                                    <a href="${uiFloorPanel.items[itemStatus.index+1].link}"><img
                                                                            style="${uiFloorPanel.items[itemStatus.index+1].css}"
                                                                            src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+1].image}"></a>
                                                                </li>
                                                                <li>
                                                                    <a href="${uiFloorPanel.items[itemStatus.index+2].link}"><img
                                                                            style="${uiFloorPanel.items[itemStatus.index+2].css}"
                                                                            src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+2].image}"></a>
                                                                </li>
                                                                <li>
                                                                    <a href="${uiFloorPanel.items[itemStatus.index+3].link}"><img
                                                                            style="${uiFloorPanel.items[itemStatus.index+3].css}"
                                                                            src="<%=getRandomFileserver()%>${uiFloorPanel.items[itemStatus.index+3].image}"></a>
                                                                </li>
                                                            </div>
                                                        </c:if>
                                                    </c:forEach>
                                                </ul>
                                                <div class="cl"></div>
                                            </div>
                                        </div>
                                    </c:when>
                                </c:choose>
                            </c:when>
                        </c:choose>
                    </c:forEach>

                </div>

            </c:forEach>

            <!-- 今日特卖 -->
            <div class="active-today">
                <div class="act-title"><span>今日特卖</span></div>
                <div class="drug-list" id="todayShopHtml">

                    </div>
                </div>
            </div>


            <!-- 热销商品 -->
            <div class="homepage-hotsale product-box marketing-box">
                <div class="hd">
                    <div class="tit" style="background: none;padding-left: 0;"><img
                            style="height: 1rem;vertical-align: middle;display: inline-block;margin: -.125rem 0.2rem 0 0.3rem"
                            src="${webctx}/images/ico-hot-red.png"/><span style="vertical-align: middle;">热销商品</span>
                    </div>
                    <a class="more" href="javascript:;">更多</a>
                </div>
                <div class="content">
                    <ul id="hotProductPanel">
                    </ul>
                    <div class="aui-clearfix"></div>
                    <div id="hotProductHolder"
                         style=" margin: 10px 0; color: #999; text-align: center;display: none;"></div>

                </div>
            </div>
        </div>

    </div>
</div>

<%request.setAttribute("bottomMenuId", "home");%>
<%@ include file="/wesite/view/common/popup-menu.jsp" %>
<%@ include file="/wesite/view/common/bottom.jsp" %>

</body>


<script type="text/javascript">

    apiready = function () {
        api.parseTapmode();
    }

    /*切换*/
    var tab = new auiTab({
        element: document.getElementById("tab"),
    });

    $('.aui-tab-item').click(function () {
        var index1 = $(this).index();
        $('.tab-content .tab-ct-item').eq(index1).show().siblings().hide()
    });

    /*滚动图*/
    var slide = new auiSlide({
        container: document.getElementById("aui-slide"),
        "speed": 500,
        "autoPlay": 3000, //自动播放
        "pageShow": true,
        "pageStyle": 'dot',
        "loop": true,
        'dotPosition': 'center',
    });

</script>
<script>
    $(function () {
        $w.httpRequest({
            url: apiroot + "/we/todaySell",
            ok: function (ret) {
                var dateitem = ret.Data.list;
                var h = "";
                for (var i = 0; i < dateitem.length; i++) {
                        h +="<div class='drug-list-item'>";
                        if (dateitem[i].fs_amount <= 0) {
                            h += "<a class='drug-picture' href='" + ctx + "/product/info?priceid= " + dateitem[i].pp_id + "'><img src='" + getRandomFileserver() + dateitem[i].pic_photoview + "' onerror='this.src=\"" + ctx + "/website/images/noimg.jpg\"'  alt='' ><span class='bg'></span><span class='msg-txt'>已抢完</span></a>";
                            h += " <a class='ico-shopping-cart' href='javascript:;'><img src='" + ctx + "/wesite/images/ico-shopping-cart-no.png'></a>";
                        } else {
                            h += "<a class='drug-picture' href='" + ctx + "/product/info?priceid= " + dateitem[i].pp_id + "'><img src='" + getRandomFileserver() + dateitem[i].pic_photoview + "' onerror='this.src=\"" + ctx + "/website/images/noimg.jpg\"'  alt='' ></a>";

                            h += " <a class='ico-shopping-cart' href='javascript:;'onclick='stopBubble(event," + dateitem[i].pp_id + ")'><img src='" + ctx + "/wesite/images/ico-shopping-cart.png'></a>";
                        }

                        h += "<div class='item-text'>";
                        h += "<p class='p1-name'>" + dateitem[i].pp_name + " " + dateitem[i].b_guige + "</p>";
                        h += "<p class='p2-company'>" + dateitem[i].b_chanjia + "</p>";
                        if (dateitem[i].pm_promotion_type == 0) {
                            if (dateitem[i].can_promotion == 1) {
                                h += ("<p class='p3-price'>" + ((isuserauth && islogin) ? "￥" + dateitem[i].fs_price + " <span>￥" + dateitem[i].pr_price + "</span>" : (!islogin ? "登录可见" : "审核通过可见")) + "</p>");
                            } else {
                                h += "<p class='p3-price'>" + ((isuserauth && islogin) ? "¥" + dateitem[i].pr_price : (!islogin ? "登录可见" : "审核通过可见")) + "</p>";
                            }

                            if (dateitem[i].fs_count_down == 0 && dateitem[i].fs_amount > 0) {
                                h += " <p class='p4 drug-overtime'>活动火热进行中</p>";
                            } else if (dateitem[i].fs_count_down == 1 && dateitem[i].fs_amount > 0) {
                                h += " <p class='p4 drug-overtime' endTime=" + dateitem[i].pm_surplus_seconds + "></p>";
                            } else {
                                h += "<p class='p4'><em>" + dateitem[i].fs_sold_amount + "</em> 件单品已抢完了</p>";
                            }
                        }
                        if (dateitem[i].pm_promotion_type == 1) {

                            if (dateitem[i].can_promotion == 1) {
                                h += ("<p class='p3-price'>" + ((isuserauth && islogin) ? "¥" + dateitem[i].pr_price + "<span></span>" : (!islogin ? "登录可见" : "审核通过可见")) + "</p>");
                            } else {
                                h += "<p class='p3-price'>" + ((isuserauth && islogin) ? "¥" + dateitem[i].pr_price : (!islogin ? "登录可见" : "审核通过可见")) + "</p>";
                            }
                            if (dateitem[i].can_promotion == 1) {
                                h += ("<p class='p4'>买" + dateitem[i].bs_buy_number + " 送 " + dateitem[i].send_number + "</p>");
                            }
                        }
                        h += " </div>";
                        h += "<div class='aui-clearfix'></div>";
                        h +="</div>"
                    }
                $("#todayShopHtml").append(h);
            }
        });
        var flashSaleTimeInterval = window.setInterval(function () {
            var drugOvertimeItems = $(".drug-overtime[endTime]");
            if (drugOvertimeItems.length > 0) {
                drugOvertimeItems.each(function () {
                    var endTime = $(this).attr("endTime");
//                    console.log(endTime);
                    if (endTime > 0) {
                        var h = parseInt(endTime / (60 * 60));//小时
                        var m = parseInt(endTime / 60 % 60);//分钟
                        var s = parseInt(endTime % 60); //秒
                        $(this).html("疯抢倒计时：<em>" + h + "</em> 时 <em>" + m + "</em> 分 <em>" + s + "</em> 秒");
                        endTime--;
                        $(this).attr("endTime", endTime);
                    } else {
                        $(this).html("活动已截止");
                        $(this).removeAttr("endTime");
                    }
                });
            } else {
                window.clearInterval(flashSaleTimeInterval);
            }
        }, 1000);
    })

</script>

<script>

    var hotsLoading = false;
    var nextHotsPageNo = 1;
    function loadhots() {
        if (hotsLoading) {
            return false;
        } else {
            hotsLoading = true;
        }
        $("#hotProductHolder").text("正在加载 ...").show();
        var url = apiroot + '/we/product/hots?pagesize=10&pageno=' + nextHotsPageNo;
        $w.httpRequest({
            url: url,
            data: {},
            ok: function (ret) {
                hotsLoading = false;

                var datas = ret.Data;

                $("#hotProductHolder").text("正在加载 ...").show();
                if (datas && datas.list && datas.list.length > 0) {
                    var panel = $("#hotProductPanel");

                    for (var i = 0; i < datas.list.length; i++) {
                        var data = datas.list[i];
                        var h = "";
                        h += ("<li onclick=\"javascript:window.location='" + ctx + "/we/product/" + data.priceid + "';\">");
                        h += ("<img src='" + getRandomFileserver() + data.photo + "' onerror='this.src=\"" + ctx + "/website/images/noimg.jpg\"' >");
                        h += ("<h3>" + data.productname + ' ' + (data.attrname || "") + "</h3>");
                        h += ("<span class='company'>" + (data.b_chanjia || "") + "</span>");
                        h += ("<span class='specifications'>" + (data.b_guige || "") + "</span>");
                        if (isuserauth && islogin) {
                               h += ("<span class='price'>");
                            h += ("<i class='a'> ¥" + data.price + "</i>");
                            if (data.promotion_coupon) {
                                h += ("<em>券</em>");
                            }
                            if(data.promotion_flash_sale){
                                h += ("<em>特价</em>");
                            }
                            if(data.promotion_buy_send){
                                h += ("<em>买送</em>");
                            }
                            if(data.promotion_money_off){
                                h += ("<em>满减</em>");
                            }
                            if(data.promotion_purchase_gift){
                                h += ("<em>满赠</em>");
                            }
                            h += ("</span>");

                        }else if (!islogin) {
                               h += ("<span class='price'><p><i class='a'>登录可见</i></p></span>");
                        }else {
                            h += ("<span class='price'><p><i class='a'>审核通过可见</i></p></span>");
                        }

                     /*   h += ("<span class='price'><p><i class='a'>" + ((isuserauth && islogin) ? '¥ ' + data.price  : (!islogin ? "登录可见" : "审核通过可见")) + "</i></p></span>");*/
                        h += ("</li>");
                        panel.append(h);
                    }
                    nextHotsPageNo++;
                    $("#hotProductHolder").hide();
                } else {
                    nextHotsPageNo = 0;
                    $("#hotProductHolder").text("已加载全部");
                }

            }
        })
    }

    $(function () {
        loadhots();
        var bottomHeight = $("div.bottom-nav").height() * 2;
        var scroll = new auiScroll({
            listen: true, //是否监听滚动高度，开启后将实时返回滚动高度
            distance: bottomHeight //判断到达底部的距离，isToBottom为true
        }, function (ret) {
            if (ret.isToBottom) {
                if (nextHotsPageNo > 0) {
                    loadhots();
                }
            }
        });


        $(window).scroll(function () {
            var top = $(".aui-slide-page-wrap").offset().top; //获取指定位置
            var hig = $(".search").outerHeight(true);
            var scrollTop = $(window).scrollTop();  //获取当前滑动位置
            if (scrollTop > top - hig) {                 //滑动到该位置时执行代码
                $(".search").addClass("bg-blue");
            } else {
                $(".search").removeClass("bg-blue");
            }
        });


    });

</script>

</html>
<script>
    $(function () {
        $w.httpRequest({
            url: apiroot + "/user/userNoNum",
            data: {},
            ok: function (ret) {
                var data = ret.Data;
                var newsnum = data.newsnum
                if (newsnum > 0) {
                    $(".message").addClass("message-have");
                } else {
                    $(".message").removeClass("message-have");
                }
            }
        })
    })
</script>